package hushi.controller;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import sun.management.Agent;

/**
 * 获取请求头内容
 */
@org.springframework.stereotype.Controller
//@RequestMapping("user")
public class Controller {
    @RequestMapping("search")
    public ModelAndView doPathVariable(@RequestHeader("Host") String host,
                                       @RequestHeader("User-Agent") String agent){
        System.out.println(host);
        System.out.println(agent);
        //拿到的是 浏览器f12检查元素->网络->名称->标头->请求标头 里面的内容
        //localhost:8080
        //Apache-HttpClient/4.5.14 (Java/17.0.10)

        return new ModelAndView("/search.jsp");
    }
}
